import 'package:flutter/material.dart';
import 'package:flutter_app/widgets/form_item_field.dart';

class FormItemRadio extends StatelessWidget {
  const FormItemRadio({
    Key? key,
    required this.options,
    required this.lable,
    required this.onChange,
    this.value,
  }) : super(key: key);
  final String lable;
  final int? value;
  final List<String> options;
  final ValueChanged onChange;
  @override
  Widget build(BuildContext context) {
    return CommonFormItemField(
      contentBuilder: (context) {
        return Expanded(
          child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: List.generate(
                  options.length,
                  (index) => Row(
                        children: [
                          Text(options[index]),
                          Radio(
                              value: index,
                              groupValue: value,
                              onChanged: onChange)
                        ],
                      ))),
        );
      },
      lable: lable,
    );
  }
}
